package com.itfreer.file;

import android.os.Environment;
import android.support.test.runner.AndroidJUnit4;
import android.util.Log;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.File;

@RunWith(AndroidJUnit4.class)
public class PathTest {

    @Test
    public void useAppContext() {
        String directoryName="PublicFileTest";
        File publicDownloadDirectory= Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_DOWNLOADS);
        File myDownloadDirectory=new File(publicDownloadDirectory,directoryName);

        if(!myDownloadDirectory.exists()){//确保指定目录已经创建
            boolean createResult=myDownloadDirectory.mkdirs();
            if(createResult){
                Log.i("a","创建成功");
            }else{
                Log.i("a","创建失败");
            }
        }
    }

}
